package com.hibiscusking.basic.config;

import com.hibiscusking.basic.interptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import sun.rmi.runtime.Log;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Autowired
    private LoginInterceptor loginInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**") // 拦截所有
                .excludePathPatterns(
                        "/login/**", // 放行登录
                        "/register/**", // 放行注册
                        "/verifyCode/**",// 放行验证码获取
                        "/shop/settlement",// 放行店铺入驻
                        "/fastdfs/**" // 放行图片的上传
                );
    }
}
